package com.prs.crm.dao.approval.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.approval.ApplicationDao;
import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.domain.approval.Application;

public class ApplicationDaoImpl extends BaseDaoImpl<Application> implements ApplicationDao{

	@Override
	public List<Application> getAllApp() {
		Criteria cri = this.getSession().createCriteria(Application.class);
		return cri.list();
	}

	@Override
	public Application getApplicationByid(Integer id) {
		Criteria cri = this.getSession().createCriteria(Application.class)
			.add(Restrictions.eq("id", id));
		return (Application) cri.list().get(0);
	}

//	@Override
//	public List<Application> getAllBysqType(Integer type) {
//		Criteria cri = this.getSession().createCriteria(Application.class)
//		.add(Restrictions.eq("sqType", type));
//		
//		return cri.list();
//	}

	@Override
	public Application getApplication(String appName) {
		Criteria cri = this.getSession().createCriteria(Application.class)
		.add(Restrictions.eq("appName", appName));
	return (Application) cri.list().get(0);
	}

}
